<!---
	TEMPLATE: Application.cfm
	AUTHOR: Matt Woodward (mpwoodward@gmail.com)
	DATE: 2/22/2005
	PURPOSE: Application.cfm for CFHibernate test application
	CHANGE HISTORY:
		* 2/22/2005: template created (Matt Woodward)
		* 27/06/2006: updated template to use HibernateFactory, and 
		singleton of sessionFactory (Mark Mandel)
		
--->

<cfapplication name="cfhibernate" sessionmanagement="yes" />

<cfscript>
	// initialize the application variables if necessary
	if ((Not StructKeyExists(Application, "inited") OR 
		Not Application.inited) OR 
		(StructKeyExists(url, "reinit") AND url.reinit)) {
		// set inited flag
		Application.inited = true;
		
		// set DSN
		Application.dsn = "cfhibernate";
		
		Application.hibernateFactory = createObject("component", "cfhibernate.HibernateFactory").init(expandPath("/lib/"));
		
		//put the sessionFactory in application scope
		Application.sessionFactory = application.HibernateFactory.configure().buildSessionFactory();
	}
</cfscript>
